package com.my.mall.client.shippingAddress.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.my.mall.client.shippingAddress.dao.ShippingAddressClientDao;
import com.my.mall.client.shippingAddress.dto.ShippingAddressClientDTO;
import com.my.mall.client.shippingAddress.vo.ShippingAddressClientVo;

@Service
public class ShippingAddressClientService {
	@Autowired
	ShippingAddressClientDao shippingAddressClientDao;

	public List<ShippingAddressClientVo> selectShippingAddressList(int userId) {
		return shippingAddressClientDao.selectShippingAddressList(userId);
	}

	public int update(ShippingAddressClientDTO address) {
		return shippingAddressClientDao.update(address.getId(), address.getIsDefault(), address.getConsignee(),
				address.getMobile(), address.getZipCode(), address.getProvinceName(), address.getCityName(),
				address.getDistrictName(), address.getStreetName(), address.getAddress());
	}

	public int save(ShippingAddressClientDTO address) {
		return shippingAddressClientDao.save(address.getUserId(), address.getIsDefault(), address.getConsignee(),
				address.getMobile(), address.getZipCode(), address.getProvinceName(), address.getCityName(),
				address.getDistrictName(), address.getStreetName(), address.getAddress());
	}

	public int del(int id) {
		return shippingAddressClientDao.del(id);
	}
	
	public ShippingAddressClientVo getShippingAddress(int id) {
		return shippingAddressClientDao.getShippingAddress(id);
	}
}